<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>命名路由</title>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
</head>
<body>
    <div id="app">
        <router-view></router-view>
        <router-view name="two"></router-view>
        <router-view name="three"></router-view>
    </div>
    <script>
        const MyOne={template:`<div>组件一</div>`};
        const MyTwo={template:`<div>组件二</div>`};
        const MyThree={template:`<div>组件三</div>`};

        const routes = [
            {
                path:"/",
                components:{
                    default:MyOne,
                    two:MyTwo,
                    three:MyThree
                }
            }
        ];

        const router = new VueRouter({
            routes,
        })

        const app = new Vue({
            el:"#app",
            router,
        })
    </script>
</body>
</html>